package cn.gson.springboot.model.service;

import cn.gson.springboot.model.dao.CustomerDao;
import cn.gson.springboot.model.mapper.CustomerMapper;
import cn.gson.springboot.model.pojos.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CustomerService {
    @Autowired
    CustomerMapper cusMapper;
    @Autowired
    CustomerDao CustomerDao;

    public List<Customer> selectAllCustomer(){
        return cusMapper.selectAllCustomer();
    }

    public List<Customer> selectCustomerByEmp(Integer deptId,Integer type){
        return cusMapper.selectCustomerByEmp(deptId,type);
    }

    public List<Customer> selectCustomerByFuzzyEmp(Integer deptId,String customerName,Integer type){
        return cusMapper.selectCustomerByFuzzyEmp(deptId,customerName,type);
    }
    public List<Customer> selectAllCustomerByType(Integer customerType){
        return cusMapper.selectAllCustomerByType(customerType);
    }

    public List<Customer> selectAllCustomerByEmpId(Integer empId){
        return cusMapper.selectAllCustomerByEmpId(empId);
    }

    public List<Customer> selectOtherCustomerByEmpId(Integer empId){
        return cusMapper.selectOtherCustomerByEmpId(empId);
    }

    public List<Customer> selectCustomerBySearchValue(String searchValue){
        return  cusMapper.selectCustomerBySearchValue(searchValue);
    }

    public List<Customer> selectAllCustomerAndContract(){
        return cusMapper.selectAllCustomerAndContract();
    }

    public List<Map<String,Object>> customerNumberByLifeCycle(){
        return cusMapper.customerNumberByLifeCycle();
    }

    public List<Map<String,Object>> myCustomerNumberByLifeCycle(Integer empId){
        return cusMapper.myCustomerNumberByLifeCycle(empId);
    }

    public List<Map<String,Object>> customerNumberByFrom(){
        return cusMapper.customerNumberByFrom();
    }

    public List<Map<String,Object>> myCustomerNumberByFrom(Integer empId){
        return cusMapper.myCustomerNumberByFrom(empId);
    }
    public List<Map<String,Object>> contractNumberByAll(){
        return cusMapper.contractNumberByAll();
    }
    public List<Map<String,Object>> contractNumberByEmp(Integer empId){
        return cusMapper.contractNumberByEmp(empId);
    }

    public  void newCustomer(Customer customer){
        CustomerDao.save(customer);
    }

    public  void updateCustomer(Customer customer){
        CustomerDao.save(customer);
    }

}
